<extend name="Member:base" />
<block name="title"><title>心心向善-实物交易订单</title></block>
		<!-- 头部结束-->
<block name="body">

			<!--<主要区块>-->
			<div class="right-layout">
				<!--<link rel="stylesheet" type="text/css" href="css/jquery.ui.css">-->
				<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/lib/jedate/skin/jedate.css" />
				<script src="__PUBLIC__/Home/lib/jedate/jedate.min.js" type="text/javascript" charset="utf-8"></script>
				<div class="wrap">
					<div class="tabmenu">
						<ul class="tab pngFix">
							<li class="active">
								<a href="/member/swjydd.html">订单列表</a>
							</li>
						</ul>
					</div>
					<form method="get" action="swjydd.html" target="_self">
						<table class="ncm-search-table">
							<!-- <input type="hidden" name="act" value="member_order">
							<input type="hidden" name="recycle" value=""> -->
							<tbody>
								<tr>
									<td>&nbsp;</td>
									<th>订单状态</th>
									<td class="w100">
										<select name="status">
											<option value="mr" {$zt_mr}>所有订单</option>
											<option value="10" {$zt_0}>待付款</option>
											<option value="20" {$zt_1}>待发货</option>
											<option value="30" {$zt_2}>待收货</option>
											<option value="40" {$zt_3}>待评价</option>
											<option value="4" {$zt_4}>待退款</option>
											<option value="5" {$zt_5}>已完成</option>
											<option value="6" {$zt_6}>已退款</option>
										</select>
									</td>
									<th>下单时间</th>
									<td class="w240">
									<input type="text" class="text w70 hasDatepicker" name="query_start_date" id="query_start_date" value="{$kstime}" readonly="readonly"><label class="add-on"><i class="icon-calendar"></i></label>&nbsp;–&nbsp;<input type="text" class="text w70 hasDatepicker" name="query_end_date" id="query_end_date" value="{$jstime}" readonly="readonly"><label class="add-on"><i class="icon-calendar"></i></label>
									</td>
									<th>订单号</th>
									<td class="w160">
									<input type="text" class="text w150" name="order_sn" value="{$order_sn}">
									</td>
									<td class="w70 tc"><label class="submit-border">
			            <input type="submit" class="submit" value="搜索">
			          </label></td>
								</tr>
							</tbody>
						</table>
						<script type="text/javascript">
							jeDate({
								dateCell: "#query_start_date",
								format: "YYYY-MM-DD",
								isTime: false,
								minDate: "1900-1-1",
								maxDate: "2099-12-12"
							});
							jeDate({
								dateCell: "#query_end_date",
								format: "YYYY-MM-DD",
								isTime: false,
								minDate: "1900-1-1",
								maxDate: "2099-12-12"
							});
						</script>
					</form>
					
						<!--<tbody>
			      <tr>
			        <td colspan="20" class="norecord"><div class="warning-option"><i>&nbsp;</i><span>暂无符合条件的数据记录</span></div></td>
			      </tr>
			    </tbody>-->
						<table class="ncm-default-table order">
							<thead>
								<tr>
									<th class="w10"></th>
									<th colspan="2">商品</th>
									<th class="w100">单价（元）</th>
									<th class="w40">数量</th>
									<th class="w100">售后</th>
									<th class="w120">订单金额</th>
									<th class="w100">交易状态</th>
									<th class="w150">交易操作</th>
								</tr>
							</thead>
						 <foreach name='list' item='v'>
							<in name="v.order_state" value="20,30,40">
							<tbody order_id="">
							
								<tr>
									<td colspan="19" class="sep-row"></td>
								</tr>
								<tr>
									<th colspan="19"> 
										<span class="ml10">
									          <!-- order_sn -->
									          订单号：{$v.order_sn}       
										</span>
										<!-- order_time -->
										<span>下单时间：{$v.add_time|date="Y-m-d H:i:s",###}</span>

										<!-- store_name -->
										<span><a href="#" title="1111">{$v.store_name}</a></span>

										<!-- QQ -->
										<span member_id="4">总金额：
										
										<if condition="$v.order_amount gt 0">￥{$v.order_amount}<if condition="$v.points_amount gt 0"> + </if></if><if condition="$v.points_amount gt 0"> {$v.points_amount} 积分 </if>
								
										<if condition="$v.gold_amount gt 0"> 
										<if condition="$v.order_amount gt 0"> + 
										<else/>
										<if condition="$v.points_amount gt 0"> + </if>
										</if>
										{$v.gold_amount} 币 </if>
										
										<if condition="$v.shipping_fee eq 0" >（免运费）
								        <else/>
								        +{$v.shipping_fee}（运费）
								        </if>
										</span>
                                <div style="float: right;margin-right: 0px;">
									<if condition="$v.order_state eq 20" >
                                    <span style="float: left;margin-left: 0px;margin-right: 118px;"><a href="" >等待发货</a></span>
                                    </if>
                                    <if condition="$v.order_state eq 30" >
                                    <span style="float: left;margin-left: 0px;margin-right: 118px;"><a href="/member/qrsh.html?order_id={$v.order_id}" >确认收货</a></span>
                                    </if>
                                    <if condition="$v.zt eq 1" >
										<span class="share-goods" style="float: right;margin-right: 10px;">全部退款</span>
									<else/>
									    <a href="/member/tk.html?id={$v.id}&qb=qb" class="share-goods" style="color: #0279B9;">全部退款</a>
									</if>
								</div>
										<!-- <a href="javascript:void(0)" class="share-goods" nc_type="sharegoods" data-param="{&quot;gid&quot;:&quot;233&quot;}">分享</a> -->

										<!-- 放入回收站 -->

										<!-- 还原订单 -->

									</th>
								</tr>

								<!-- S 商品列表 -->
								<?php foreach($v['sptable'] as $key => $value){?>
								<tr>
									<td class="bdl"></td>
									<td class="w70">
										<div class="ncm-goods-thumb">
											<a href="/shop/goods.html?gid=<?php echo $value['goods_id']?>" target="_blank">
											<!-- <img src="__PUBLIC__/Home/images/web-2-25-1-34.jpg" onmouseover="toolTip('<img src=__PUBLIC__/Home/images/web-2-25-1-34.jpg>')" onmouseout="toolTip()"> -->
											<img src="<?php echo $value['goods_image']?>" onmouseover="toolTip('<img src=<?php echo $value['goods_image']?>>')" onmouseout="toolTip()">
											</a>
										</div>
									</td>
									<td class="tl">
										<dl class="goods-name">
											<dt><a href="/shop/goods.html?gid=<?php echo $value['goods_id']?>" target="_blank"><font style="color:red;"><?php echo $value['color_n']?> <?php echo $value['spec_n']?></font>   <?php echo $value['goods_name']?> </a>
											
											</dt>
										</dl>
									</td>
									<td>
									
										<?php if($value['goods_pay_price']>0){echo '￥';echo $value['goods_pay_price'];
										if ($value['point_num']>0) {
											echo '+';
										}
										}if ($value['point_num']>0) {
											echo $value['point_num'];echo '&nbsp;积分';
										} ?>									
									</td>
									<td><?php echo $value['goods_num']?></td>
									<td>
										<!-- 退款 -->

										<p>
										<?php if($value['status']!='0' && $value['status']!=4 && $value['status']!=6){?>
										<a href="/member/tk.html?id=<?php echo $value['rec_id']?>">退款</a>
										<?php }else{?>
										退款
										<?php }?>
										</p>
										<p>
											<a href="/member/th.html?id=<?php echo $value['rec_id']?>">换货</a>
										</p>
										<!-- <p>
											<a onClick="javascript:if(!confirm('确定退款/退货吗？'))  return  false; " href="#">退款/退货</a>
										</p> -->

										<!-- 投诉 -->

										<!-- <p>
											<a href="#">交易投诉</a>
										</p> -->
									</td>

									<!-- S 合并TD -->
									<td class="bdl" rowspan="1">
										<p class=""><strong><?php if($value['goods_pay_price']>0){echo '￥';echo $value['goods_num']*$value['goods_pay_price'];
										if ($value['point_num']>0) {
											echo '+';
										}
										}if ($value['point_num']>0) {
											echo $value['goods_num']*$value['point_num'];echo '&nbsp;积分';
										} ?></strong></p>
										<p class="goods-freight">
										<!-- <?php if($value['freight']==0){?>
											<?php echo '（免运费）'?>
										<?php }else{?>
										    <?php echo '+'.$value['freight'].'（运费）'?>
										<?php }?>-->
										</p>
										<p title="支付方式：{$v.pay_name}">{$v.pay_name}</p>
									</td>
									<td class="bdl" rowspan="1">
										<p>
										<if condition="$v.order_state eq '10'" >
											待付款
										</if>
										<if condition="$v.order_state eq '20'" >
											待发货
										</if>
										<if condition="$v.order_state eq '30'" >
											待收货
										</if>

										<?php if($value['status']==3){?>
										<?php echo '待评价'?>
										<?php }else if($value['status']==4){?>
										<?php echo '待退款'?>
										<?php }else if($value['status']==5){?>
										<?php echo '已完成'?>
										<?php }else if($value['status']==6){?>
										<?php echo '已退款'?>
										<?php }?>
										</p>

										<!-- 订单查看 -->

										<p>
										<if condition="$v.order_state gt 10" >
											<a href="/member/ddxq.html?id={$v.order_id}&qb=qb" target="_blank">订单详情</a>
										</if>
										</p>

										<!-- 物流跟踪 -->

									</td>
									<td class="bdl bdr" rowspan="1">
										<!-- 永久删除 -->

										<!-- 锁定-->

										<!-- 取消订单 -->

										<!-- 退款取消订单 -->

										<!-- 收货 -->

										<p>
										<in name="v.order_state" value='10' >
										
											<a class="ncm-btn" style="background-color:#bbbbbb;    color: #fff!important;">等待付款</a>
										</in>
										<in name="v.order_state" value='20' >
										
											<a class="ncm-btn" style="background-color:#bbbbbb;    color: #fff!important;">待发货</a>
										</in>
										<in name="v.order_state" value="30" >
										
											<a href="/member/qrsh.html?order_id={$v.order_id}" class="ncm-btn" id="order2_action_confirm">确认收货</a>
										</in>

										<?php if($value['pj_content']==''){?>
										
											<if condition="$v.order_state eq '40'" >
												<a class="ncm-btn ncm-btn-acidblue" href="/member/wypj.html?id=<?php echo $value['order_id']?>">我要评价</a>
											</if>
										
										<?php }else{?>
                                        <?php echo '已评价过'?>
										<?php }?>
										</p>

										<!-- 评价 -->

										<!-- 已经评价 -->

									</td>
									<!-- E 合并TD -->
								</tr>
								<?php }?>

								<!-- S 赠品列表 -->

								<!-- E 赠品列表 -->

								<!-- E 商品列表 -->
							
							</tbody>
							</in>
							<in name="v.order_state" value="10">
							<tbody order_id="" class="pay">
								 <tr>
									<td colspan="19" class="sep-row"></td>
								  </tr>
								  <tr>
									<td colspan="19" class="pay-td"><span class="ml15">在线支付金额：<em>￥{$v.order_amount}</em></span> <a class="ncm-btn ncm-btn-orange fr mr15" href="/shop/buy_step2.html?act=buy&op=pay&pay_sn={$v.order_sn}" target="_blank"><i class="icon-shield" ></i>订单支付</a></td>
								  </tr>
											  <tr>
									<th colspan="19"> 
										<span class="ml10">
									  <!-- order_sn -->
									   订单号：{$v.order_sn}  
									   </span>
									  <!-- order_time -->
									  <span>下单时间：{$v.add_time|date="Y-m-d H:i:s",###}</span>

									  <!-- store_name -->
									  <span><a href="" title="shop">{$v.store_name}</a></span>

									  <!-- QQ -->
									  <span member_id="1">         
									  <!-- wang wang -->
									  </span> 
									  <a href="javascript:void(0)" class="share-goods" nc_type="sharegoods" data-param="{&quot;gid&quot;:&quot;53&quot;}"><i class="icon-share"></i>分享</a>
								   </th>
								  </tr>

								  <!-- S 商品列表 -->
								  <foreach name="v.sptable" item="vo">
								  <tr>
									<td class="bdl"></td>
									<td class="w70"><div class="ncm-goods-thumb"><a href="/shop/goods.html?gid={$vo.goods_id}" target="_blank"><img src="{$vo.goods_image}" onmouseover="toolTip('<img src={$vo.goods_image}>')" onmouseout="toolTip()"></a></div></td>
									<td class="tl"><dl class="goods-name">
										<dt><a href="/shop/goods.html?gid={$vo.goods_id}" target="_blank"><font style="color:red;">{$vo.color_n} {$vo.spec_n}</font>    {$vo.goods_name} </a>
										
										</dt>
										</dl></td>
									<td>
									
										<if condition="$vo.goods_pay_price gt 0">￥{$vo.goods_pay_price}<if condition="$vo.point_num gt 0"> + </if></if><if condition="$vo.point_num gt 0"> {$vo.point_num} 积分 </if>	
										<if condition="$vo.coin_num gt 0"> 
										<if condition="$vo.goods_pay_price gt 0"> + 
										<else/>
										<if condition="$vo.point_num gt 0"> + </if>
										</if>
										{$vo.coin_num} 币 </if>										
									</td>
									<td>{$vo.goods_num}</td>
									<td><!-- 退款 -->
									  <!-- 投诉 -->

								   </td>

									<!-- S 合并TD -->
									<td class="bdl" rowspan="1">
										<p class=""><strong>
										<if condition="$vo.goods_pay_price gt 0">￥{$vo[goods_pay_price]*$vo[goods_num]}<if condition="$vo.point_num gt 0"> + </if></if><if condition="$vo.point_num gt 0"> {$vo[point_num]*$vo[goods_num]} 积分 </if>
										
										<if condition="$vo.coin_num gt 0"> 
										<if condition="$vo.goods_pay_price gt 0"> + 
										<else/>
										<if condition="$vo.point_num gt 0"> + </if>
										</if>
										{$vo[coin_num]*$vo[goods_num]} 币 </if>										
										</strong></p>
										<p class="goods-freight">										
										<if condition="$v.shipping_fee eq 0" >（免运费） <else/>+{$v.shipping_fee}（运费）</if>
										</p>
										<p title="支付方式：{$v.pay_name}">{$v.pay_name}</p>
									</td>
									<td class="bdl" rowspan="1"><p>待付款 </p>

									  <!-- 订单查看 -->
									  <p><a href="/member/ddxq.html?id={$v.order_id}&qb=qb" target="_blank">订单详情</a></p>

									  <!-- 物流跟踪 -->
									  </td>
									<td class="bdl bdr" rowspan="1"><!-- 永久删除 -->

									  <!-- 锁定-->
									  <!-- 取消订单 -->
										<p>
										<a href="javascript:void(0)" class="ncm-btn ncm-btn-red" nc_type="out_order" dialog_width="480" dialog_title="取消订单" dialog_id="buyer_order_cancel_order" order_id="{$vo.order_id}"  rec_id="{$vo.rec_id}"id="order3_action_cancel"><i class="icon-ban-circle"></i> 取消订单</a>
										</p>
									  
									  <!-- 退款取消订单 -->        
									  <!-- 收货 -->         
									  <!-- 评价 --> 
									  <!-- 已经评价 -->
								   </td>
									<!-- E 合并TD -->
								</tr>
								</foreach>
								  <!-- S 赠品列表 -->
								 <!-- E 赠品列表 -->
								 <!-- E 商品列表 -->

							 </tbody>
							</in>
							</foreach>
<script type="text/javascript">
//取消订单
$('[dialog_id="buyer_order_cancel_order"]').live('click',function(){
	var url = "{:U('member/cancel_order')}" ;
	var order_id = $(this).attr("order_id");
	var rec_id = $(this).attr("rec_id");
	//alert(url);
	$.ajax({
		url:url,
		data:{act:'member_order',order_id:order_id,rec_id:rec_id,op:'change_state',state_type:'order_cancel'},
		type:'post',
		dataType:'json',
		success:function (data) {
			alert(data);	
			window.location.reload();
					
		}
	});
});
	
</script>

<style type="text/css">
.pagination li span,.pagination li a{
    font: normal 14px/20px "microsoft yahei";
    color: #AAA;
    background-color: #FAFAFA;
    text-align: center;
    display: block;
    min-width: 20px;
    padding: 8px;
    border: 1px solid #E6E6E6;
    position: relative;
    z-index: 1;
}
.pagination li a:hover{
    border-color:#F87622;
    color:#F87622;
}
.pagination li span.current {
    color: #AAA;
    font-weight: bold;
    background-color: #FAFAFA;
    border-color: #E6E6E6;
    position: relative;
    z-index: 2;
}
.pagination li a.first{
	margin-right: 8px;
}
.pagination li a.end{
	margin-left: 8px; 
}

</style>
							<tfoot>
								<tr>
									<td colspan="19">
										<div class="pagination">
											<ul>
											    {$page}
											</ul>
										</div>
									</td>
								</tr>
							</tfoot>
						</table>
					</table>
				</div>
				<!--//			<script charset="utf-8" type="text/javascript" src="js/zh-CN.js"></script>-->
				<!--//			<script charset="utf-8" type="text/javascript" src="http://www.rate.net/data/resource/js/sns.js"></script>-->
				<!--			<script type="text/javascript">
//			$(function(){
//			    $('#query_start_date').datepicker({dateFormat: 'yy-mm-dd'});
//			    $('#query_end_date').datepicker({dateFormat: 'yy-mm-dd'});
<!--//			});
			</script>-->
			</div>
			<!--</主要区块>-->
			<div class="clear"></div>
		</div>
	</block>